﻿using System;
using System.Collections.Generic;
using System.Data.Entity.Migrations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CarShop.Domain.Entities;

namespace CarShop.Data.EntityFramework
{
    public static class Seeder
    {
        public static void Seed(CarShopContext context)
        {
            context.Roles.AddOrUpdate(
                r => r.Name,
                new Role() { Name = Role.NameFor.Admin },
                new Role() { Name = Role.NameFor.Customer }
                );

            context.CarStatuses.AddOrUpdate(s => s.Name,
                new CarStatus() { Name = CarStatus.NameFor.Delivering},
                new CarStatus() { Name = CarStatus.NameFor.InStorage },
                new CarStatus() { Name = CarStatus.NameFor.Diagnostics },
                new CarStatus() { Name = CarStatus.NameFor.Repair },
                new CarStatus() { Name = CarStatus.NameFor.Sold });

            context.CarTypes.AddOrUpdate(s => s.Name,
                new CarType(){ Name = CarType.NameFor.Sedan},
                new CarType(){ Name = CarType.NameFor.Coupe},
                new CarType(){ Name = CarType.NameFor.Hatchback},
                new CarType(){ Name = CarType.NameFor.Touring});

            context.OrderStatuses.AddOrUpdate(s => s.Name,
                new OrderStatus() {Name = OrderStatus.NameFor.Cancelled},
                new OrderStatus() { Name = OrderStatus.NameFor.WaitingForApprove },
                new OrderStatus() { Name = OrderStatus.NameFor.Completed },
                new OrderStatus() { Name = OrderStatus.NameFor.InProgress });
        }
    }
}
